import asyncio
import uvicorn
from fastapi import FastAPI


app = FastAPI()

count: int = 0


@app.get("/")
def read_root():
    global count
    count += 1
    return {"Hello": f"count={count}"}


async def http_server_async():
    config = uvicorn.Config(
        app,
        host="127.0.0.1",
        port=8080,
        timeout_keep_alive=16,
        log_level="info",
    )
    server = uvicorn.Server(config)
    await server.serve()


if __name__ == "__main__":
    asyncio.run(http_server_async())
